<?php

session_start();
require_once '../dao/AdminDao.php';
require_once '../dto/AdminDto.php';

$Email = $_POST["txtEmail"];
$Email = mysql_real_escape_string($Email);
$Password = $_POST["txtPassword"];
$Password = mysql_real_escape_string($Password);

$result = AdminDao::GetAdminByEmailAndPassword($Email, $Password);
if ($result != NULL) {
    $_SESSION["Admin"] = $result;
    $_SESSION["AdminEmail"] = $result->getEmail();
    header("location:../page/DoctorList.php");
} else {
    header("location:../page/errorpage.php");
}
?>
